//
//  LoginvView.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/1/12.
//

import SwiftUI

//底部弹窗通用试图
struct PopupBottomView<Content: View>: View {
    var title:String = ""
    var noBg = false
    var edgeinsets : EdgeInsets? = nil
    @ViewBuilder var content: () -> Content
    
    var body: some View {
        VStack(spacing: 0) {
            Rectangle()
                .fill(.bgScrollTips)
                .frame(width: 35, height: 6)
                .cornerRadius(5)
            HStack{
                Text(title).font(.system(size: 16))
                    .bold()
                    .foregroundStyle(.bgNormalText)
                Spacer()
            }
            content()
        }.padding(getEdgeInsets())
            .background(noBg ? Color.clear : .bgDialog)
            .cornerRadius(15)
            .edgesIgnoringSafeArea(.all)
    }
    
    func getEdgeInsets() -> EdgeInsets {
        return edgeinsets ?? EdgeInsets(top: 7, leading: 20, bottom: 20, trailing: 20)
    }
}

#Preview {
    PopupBottomView(title: "请选择登陆方式"){}
}
